package com.droowa.model.service;

import java.sql.SQLException;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.droowa.domain.MileageOption;
import com.droowa.domain.MyShop;
import com.droowa.model.dao.MileageOptionDAO;

@Service
public class MileageOptionServiceImpl implements MileageOptionService{

	@Autowired
	MileageOptionDAO dao;

	@Override
	public int joinMileageOption(MileageOption mileageOption)
			throws SQLException {
		if(mileageOption.getJoinMileageOption()>=1){
			int update = modifyMileageOption(mileageOption);
			if(update==1){
				return -1;
			}else{
				return 0;
			}
		}
		return dao.insertMileageOption(mileageOption);
	}

	@Override
	public int modifyMileageOption(MileageOption mileageOption)
			throws SQLException {
		return dao.updateMileageOption(mileageOption);
	}

	@Override
	public int removeMileageOption() throws SQLException {
		return dao.deleteMileageOption();
	}

	@Override
	public MileageOption getMileageOption() throws SQLException {
		return dao.selectMileageOption();
	}
	
}
